package com.meritdata.cloud.data.standard.quality.dao;

import com.meritdata.cloud.data.standard.quality.entity.TdDataQualityRule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;

import javax.transaction.Transactional;
import java.util.Date;

public interface IQualityDao extends JpaRepository<TdDataQualityRule,Long>, QuerydslPredicateExecutor<TdDataQualityRule> {
    @Modifying
    @Transactional
    @Query("update TdDataQualityRule as c set c.name=:name ,c.updateTime=:updateTime,c.conditionExp=:conditionExp,c.conditionType=:conditionType,c.description=:description where c.id=:id")
    int update(Long id, String name, String conditionExp, int conditionType, String description, Date updateTime);
    @Modifying
    @Transactional
    @Query("update TdDataQualityRule as c set c.publishState=:publishState,c.updateTime=:updateTime  where c.id=:id")
    int updatePublishState(Long id, Integer publishState, Date updateTime);

}
